﻿<Window x:Class="DataFrameworkGenerator.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ViewModel="clr-namespace:DataFrameworkGenerator.ViewModel"
        xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
        xmlns:Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF4"
        Title="MainWindow" Height="450" Width="525">
    <Window.DataContext>
        <ViewModel:MainViewModel />
    </Window.DataContext>
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Closing">
            <Command:EventToCommand Command="{Binding SaveSettings}"/>
        </i:EventTrigger>
    </i:Interaction.Triggers>
    <Grid Margin="4 4 4 4">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*" />
            <ColumnDefinition Width="1*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="1*" />
            <RowDefinition Height="1*" />
            <RowDefinition Height="1*" />
            <RowDefinition Height="1*" />
            <RowDefinition Height="1*" />
            <RowDefinition Height="1*" />
            <RowDefinition Height="1*" />
            <RowDefinition Height="1*" />
            <RowDefinition Height="1*" />
            <RowDefinition Height="1*" />
        </Grid.RowDefinitions>

        <TextBlock Grid.Column="0" Grid.Row="0" TextAlignment="Right" VerticalAlignment="Center">Database Type: </TextBlock>
        <ComboBox Grid.Column="1" Grid.Row="0" VerticalAlignment="Center" Margin="8 0 0 0" 
                  ItemsSource="{Binding DatabaseTypes, Mode=OneWay}" SelectedValue="{Binding SelectedDatabaseType}"
                  DisplayMemberPath="Key" SelectedValuePath="Value">
        </ComboBox>

        
        <TextBlock Grid.Column="0" Grid.Row="1" TextAlignment="Right" VerticalAlignment="Center">            
            <Hyperlink CommandParameter="http://connectionstrings.com" Command="{Binding ConnectionStringLink}">Connection String:</Hyperlink>
        </TextBlock>
        <TextBox x:Name="tbConnectionString" Grid.Column="1" Grid.Row="1" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" Margin="8 0 0 0" Text="{Binding ConnectionString}" ></TextBox>

        <TextBlock Grid.Column="0" Grid.Row="2" TextAlignment="Right" VerticalAlignment="Center">Target Schema:</TextBlock>
        <TextBox x:Name="tbTargetSchema" Grid.Column="1" Grid.Row="2" TextAlignment="Left" VerticalAlignment="Center" Margin="8 0 0 0" 
                 IsEnabled="{Binding CanChangeSchema}" Text="{Binding TargetSchema}"></TextBox>

        <TextBlock Grid.Column="0" Grid.Row="3" TextAlignment="Right" VerticalAlignment="Center">Common Class Namespace:</TextBlock>
        <TextBox x:Name="tbCommonClassNamespace" Grid.Column="1" Grid.Row="3" TextAlignment="Left" VerticalAlignment="Center" Margin="8 0 0 0" Text="{Binding CommonClassNamespace}"></TextBox>

        <TextBlock Grid.Column="0" Grid.Row="4" TextAlignment="Right" VerticalAlignment="Center">Dao Class Namespace:</TextBlock>
        <TextBox x:Name="tbDaoClassNamespace" Grid.Column="1" Grid.Row="4" TextAlignment="Left" VerticalAlignment="Center" Margin="8 0 0 0" Text="{Binding DaoClassNamespace}"></TextBox>

        <TextBlock Grid.Column="0" Grid.Row="5" TextAlignment="Right" VerticalAlignment="Center">DataFramework Namespace:</TextBlock>
        <TextBox x:Name="tbDataFrameworkNamespace" Grid.Column="1" Grid.Row="5" TextAlignment="Left" VerticalAlignment="Center" Margin="8 0 0 0" Text="{Binding DataFrameworkNamespace}"></TextBox>

        <TextBlock Grid.Column="0" Grid.Row="6" TextAlignment="Right" VerticalAlignment="Center">Output Directory:</TextBlock>
        <TextBox x:Name="tbOutputDirectory" Grid.Column="1" Grid.Row="6" TextAlignment="Left" VerticalAlignment="Center" Margin="8 0 0 0" Text="{Binding OutputDirectory}"></TextBox>

        <TextBlock Grid.Column="0" Grid.Row="7" TextAlignment="Right" VerticalAlignment="Center">Company:</TextBlock>
        <TextBox x:Name="tbCompany" Grid.Column="1" Grid.Row="7" TextAlignment="Left" VerticalAlignment="Center" Margin="8 0 0 0" Text="{Binding CompanyName}"></TextBox>

        <StackPanel Grid.Column="0" Grid.Row="8" Grid.ColumnSpan="2">
            <TextBlock>Progress:</TextBlock>
            <ProgressBar x:Name="pbCurrentProgress" Height="20" Value="{Binding CurrentProgressValue, Mode=OneWay}"></ProgressBar>
        </StackPanel>

        <Button x:Name="btnGo" Grid.Column="1" Grid.Row="9" Command="{Binding GenerateClasses}">Go</Button>
    </Grid>
</Window>
